import Vue from 'vue'
import Vuex from 'vuex'
import state from './state.js'
import actions from './actions'
import mutations from './mutations'

Vue.use(Vuex)


export default new Vuex.Store({
    // state: {
    //     city: defaultCity
    // },
    // actions: {
    //     changeCityName: function(ctx, prevCity) {
    //         ctx.commit('changeCityName', prevCity)
    //     }
    // },
    // mutations: {
    //     changeCityName: function(state, prevCity) {
    //         localStorage.city = state.city = prevCity;
    //     }
    // }
    state: state,
    actions: actions,
    mutations: mutations,
    getters: {
       namedCity (state) {
           return '中国-' + state.city
       }
    }
})